I am trying to do the following:
From the original browser doc
1 – go to/invoke a servlet with a range of values taken from fields (editable) in the original browser doc and pass these values to the servlet, which will ‘reply’ in its own window
2- this means using the doPost method of the servlet, I believe. However, I am using the doGet for the moment.
3 – in this new window, one or more fields will be editable and able to be re-submitted to the servlet, which again will ‘reply’ in that same window
4- this edit, re-submit, reply process may continue for many times, but eventually, I want to take some of the values in the servlet window, back to editable fields on the original browser doc
I begin the process in Javascript – as there are a number of client-side checks to make before sending the data/values to the servlet (which itself passes them on to a logic server for processing). Code for calling the ‘intermediate’ window is:
windowOpener("/" + db + "/N1?OpenForm","X",'WIDTH=600,HEIGHT=300,scrollbars,resize');
to get the new window and to allow the transfer of data/values via
var s = window.opener.document.forms[0].Sentence1.value;
var n = window.opener.document.forms[0].Senn.value;
etc
and a button in the doc in that window with the code:
window.location="/servlet/PostServlet?sen=" + s + "&num=" + n + "&unid=" + u + "&db=" + db + "&serv=" + sr + "&frm=" + frm;
Inside the servlet, the code is naturally Java.
I have been able to get this to work only by having an intermediate window and sending the data via a doGet method. This is too indirect, and messy for users. It works well, however, for the return trip to the original browser doc – code in servlet;
out.println("<INPUT TYPE=\"BUTTON\" VALUE =\"Backtotext\" onClick=\"
javascript:window.opener.document.forms[0].Sentence1Checked.value=" + xc + ";\">");
So, is there a more direct way of calling the servlet and eventually getting the data back to the original window? Is it possible with HTML in a comp when comp field on the intermediate doc, with nothing else on the form – using it as just a sort of pass-thro? If so, what is the syntax?
Many thanks for any suggestions
Tamsin